package com.oracle.lingshangejia.adapter;

import android.support.annotation.Nullable;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.oracle.lingshangejia.R;
import com.oracle.lingshangejia.bean.ServicePackageBean;

import java.util.List;

/**
 * @松 on 2019/7/4 17:04
 * 服务包适配器
 */
public class ServicePackageAdapter extends BaseQuickAdapter<ServicePackageBean.DataBean ,BaseViewHolder> {
    public ServicePackageAdapter(@Nullable List<ServicePackageBean.DataBean> data) {
        super(R.layout.item_service_package, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ServicePackageBean.DataBean item) {
        helper.setText(R.id.tv_name, "服务包："+item.getName());
        helper.setText(R.id.tv_date,"日期：" +item.getCreateDate());
        helper.addOnClickListener(R.id.tv_name).addOnClickListener(R.id.tv_date)
            .addOnClickListener(R.id.tv_finish);

        if (item.getStatus() == 1){
            helper.getView(R.id.tv_finish).setVisibility(View.INVISIBLE);
        }else {

            helper.getView(R.id.tv_finish).setVisibility(View.VISIBLE);
        }
    }
}
